home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / gnustuff / minix / update~4.z / update~4 / lib_stdio_README.UPDATE1 < prev    next >
Encoding:
Internet Message Format  |  1989-09-06  |  3.3 KB

  1. From: cechew@bruce.OZ (Earl Chew)
  2. Newsgroups: comp.os.minix
  3. Subject: Minix stdio patches - 0 of 5
  4. Keywords: stdio, patches
  5. Message-ID: <1503@bruce.OZ>
  6. Date: 5 Sep 89 06:57:57 GMT
  7. Organization: Monash Uni. Computer Science, Australia
  8. Lines: 80
  9.  
  10.  
  11. The following files are provided in this patch:
  12.  
  13. Makefile.dos            new TurboC makefile (not very useful)
  14. Makefile.unx            new Un*x makefile
  15.  
  16. _cleanup.c.cdif        delete _cleanup.c (no longer used)
  17. _fakfls.c.cdif            new fake flush function
  18. _filbuf.c.cdif                patch
  19. _flsbuf.c.cdif                patch
  20. _fopen.c.cdif                patch
  21. atexit.c.cdif            new atexit function
  22. bitset.h.cdif                patch
  23. exercise.c.cdif                patch
  24. exit.c.cdif            new exit function
  25. fputs.c.cdif                patch
  26. fread.c.cdif                patch
  27. fwrite.c.cdif                patch
  28. proto.h.cdif        delete proto.h (no longer used)
  29. stdio.c.cdif                patch
  30. stdio.h.cdif                patch
  31. stdiolib.h.cdif                patch
  32. texit.c.cdif            new test
  33. vfscanf.c.cdif                patch
  34.  
  35. The new files will be created automatically by patch from the cdifs. The old
  36. files to be deleted will be crunched to zero size by patch. You will have
  37. to rm them yourself (_cleanup.c and proto.h).
  38.  
  39. Most of the changes are patches to fix certain lint and compile problems to do
  40. with void * and unsigned char *.
  41.  
  42. The need to #define MINIX is done away with. The package should compile under a
  43. Minix environment without any further #defines.
  44.  
  45. atexit(), exit() and _ioflush() are new functions provided in this patch kit.
  46. The older _cleanup() has been done away with. Buffer flushing proceeds as
  47. follows. The dependencies in the function calls are:
  48.  
  49. exit() -> _ioflush()
  50. putc() -> _flsbuf() -> _ioexit()
  51. fwrite() -> _ioexit()
  52.    etc
  53.  
  54. _flsbuf.o contains _ioexit(), _ioflush() and _flsbuf()
  55. _fakfls.o contains _ioflush()
  56.  
  57. Thus, the order for the modules to be put into the library should be:
  58.  
  59. `lorder "everything except exit.o and _fakfls.o" | tsort` exit.o _fakfls.o
  60.  
  61. which is the order that is specified in Makefile.unx.
  62.  
  63. Thus programs which make use of any writing function will cause _ioexit() to be
  64. called and thus haul in _flsbuf.o. _fakfls.o will be left out since it occurs
  65. last in the library. Programs which don't use stdio will eventually haul exit.o
  66. into the executable, and finally _fakfls.o.
  67.  
  68. A new atexit.c is provided which interfaces with the exit.c that is provided.
  69. These replace the ones provided by Minix. Note that _exit.c will have to be
  70. split from exit.c --- that's the way it should have been from the start.
  71. I'm sure that you can manage that yourselves.
  72.  
  73. The new test file texit.c allows you to check whether the linker has left out
  74. stdio. Under Un*x use nm to see what's been hauled in. You should see
  75. _fakfls.o. If you see the kitchen sink you know that the ld trick hasn't
  76. worked.
  77.  
  78. I trashed the old __cleanup thing since, as Bruce Evans pointed out, it wasn't
  79. particularly clean and seemed to be Minix specific. This method follows what
  80. Bruce suggested to me (as far as I could follow what he said). atexit() seemed
  81. like a good way to go, but it appears that some systems don't have it (like the
  82. BSD system here). Thus I have provided exit.c and atexit.c. For those systems
  83. which already have an atexit.c don't want to replace their exit.c, look at the
  84. MSDOS code in stdiolib.h for the SETIOFLUSH macro.
  85.  
  86. I have also placed a copyright notice in the .h files. I don't particularly mind
  87. how you use the software so long as you give credit where credit is due.
  88.  
  89. Earl
  90.